#include "vs1003.h"

#include <stdlib.h>

int VS1003_example() {
#if (0)
	FATFS fat;
	uint8 buffer[32];
	uint32 nbytes;
	FIL	fh;
	FRESULT res;
#endif
	
	/* open device */
	if(VS1003_open() != 0) {
		return -1;
	}
	
	/* start sine wave test */
	VS1003_sin_test(10000);
	
	/* play mp3 file test */
#if (0)
	f_mount(0, &fat);
	/* open MP3 file */
	res = f_open(&fh, fpath, FA_READ);
	if(res != FR_OK) {
		TRACE_ERROR("open file %s error", fpath);
		return -1;
	}
	/* 32 bytes one time */
	do {
		f_read(&fh, buffer, 32, &nbytes);
		if(nbytes)
			vs1003_write_data(buffer, 32);
	} while(nbytes);
	f_close(&fh);
#endif
	
	/* close device */
	VS1003_close();
	return 0;
}
